package com.miaoxun.web.aspect;


import com.miaoxun.common.log.LogHelper;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

@Aspect
@Component
public class LogController {
    private Logger logger = LoggerFactory.getLogger(LogController.class);

    @Pointcut("execution(* com.miaoxun.controller..*.*(..))")
    public void executeService() {

    }

//    @Around("executeService()")
//    public Object AroundAdvice(ProceedingJoinPoint point) throws Throwable {
//        Object[] objs = point.getArgs();
//        return point.proceed(objs);
//
//    }

    @AfterReturning(value = "executeService()", returning = "keys")
    public void doAfterReturningAdvice1(JoinPoint joinPoint, Object keys) {
        LogHelper.INFO("返回参数{}", keys);
    }

    @After(value = "executeService()")
    public void after(JoinPoint joinPoint) {
        LogHelper.INFO("返回参数{}", joinPoint);

    }


}
